package business_logic;

import business_logic.game_elements.ToleTole;
import business_logic.game_elements.Explosion;
import business_logic.game_elements.Molotov;
import business_logic.game_elements.Proyectil;

import model.collisions.CollisionCategory;
import model.elements.Explotion;
import model.elements.attributes.Coordinate2D;
import model.elements.attributes.Damage;
import model.elements.behaviours.Weapon;
import model.elements.factory.ElementsFactory;
import model.elements.states.movement.ElementMovementState;
import model.exceptions.ModelExceptions;

public class GameElementsFactory implements ElementsFactory
{

	public Weapon createBomb(
			Coordinate2D position, 
			double modifier
	) throws ModelExceptions {		
		Coordinate2D newPosition =  new Coordinate2D(
			Math.floor( position.getRealX() ),
			Math.floor( position.getRealY() )
		);
		return new Molotov(newPosition, modifier);
	}

	@Override
	public Weapon createBullet (
		Coordinate2D position, 
		ElementMovementState direction 
	) throws ModelExceptions {
		Coordinate2D newPosition =  new Coordinate2D(
			Math.floor( position.getRealX() ),
			Math.floor( position.getRealY() )
		);
		return new Proyectil( newPosition, direction );
	}

	@Override
	public Explotion createExplotion(
		Coordinate2D position,
		ElementMovementState direction, 
		CollisionCategory blastType,
		Damage blastDamage,
		int blastRange
	) throws ModelExceptions {		
		Coordinate2D newPosition =  new Coordinate2D(
			Math.floor( position.getRealX() ),
			Math.floor( position.getRealY() )
		);		
		return  new Explosion( newPosition, direction, blastType, blastDamage, blastRange );
	}

	@Override
	public Weapon createBombL2(
			Coordinate2D position, 
			double modifier
	) throws ModelExceptions {
		return new ToleTole( position, modifier );
	}

}
